﻿#include "filecheck.h"
#include "ui_filecheck.h"
#include <QDebug>
#include <QtWidgets>
#include "mainform.h"

#if _MSC_VER >= 1600
#pragma execution_character_set("utf-8")
#endif


FileCheck::FileCheck(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::FileCheck)
{
    ui->setupUi(this);

    m_pMainForm = NULL;

    setWindowFlags(windowFlags() | Qt::FramelessWindowHint | Qt::WindowMinMaxButtonsHint);
    setFixedSize(600, 500);
    setProperty("canMove", "true");
    setAttribute(Qt::WA_StyledBackground);  // 禁止父窗口样式影响子控件样式
    setAttribute(Qt::WA_TranslucentBackground, true);

    CreateAllChildWnd();
    InitCtrl();
    InitSolts();
    Relayout();
}

FileCheck::~FileCheck()
{
    delete ui;
}

void FileCheck::CreateAllChildWnd()
{
#define NEW_OBJECT(pObj, TYPE) \
    if (NULL == pObj) { pObj = new TYPE(this); }

    NEW_OBJECT(m_pMainForm, MainForm);
}

void FileCheck::InitCtrl()
{
    QGraphicsDropShadowEffect *shadow_effect = new QGraphicsDropShadowEffect(this);
    shadow_effect->setOffset(0, 0);
    shadow_effect->setColor(QColor(38, 78, 119, 127));
    shadow_effect->setBlurRadius(20);
    m_pMainForm->setGraphicsEffect(shadow_effect);
}

void FileCheck::InitSolts()
{

}

void FileCheck::Relayout()
{
    QVBoxLayout *mainLayout = new QVBoxLayout(this);
    mainLayout->addWidget(m_pMainForm);
    mainLayout->setMargin(20);
    setLayout(mainLayout);
}
